package com.woniuxy.lab.woniu_lab_boss.docker;


import com.woniuxy.lab.woniu_lab_boss.common.Shell;

public class Container {

    private Shell shell;

    private final static String DOCKER = "docker ";

    public Container() {
    }

    public Container(Shell shell) {
        this.shell = shell;
    }

    public static Container getContainer(Shell shell){
        return new Container(shell);
    }

    // -------------

    // 查看所有容器信息
    public String psa(){
        return shell.execCommand(DOCKER + "ps -a");
    }

    public String ps(){
        return shell.execCommand(DOCKER + "ps");
    }

    // 启动容器
    public String start(String nameOrId){
        return shell.execCommand(DOCKER + "start "+nameOrId);
    }

    // 停止运行中的容器
    public String stop(String nameOrId){
        return shell.execCommand(DOCKER + "stop "+nameOrId);
    }

    // 删除容器
    public String rm(String nameOrId){
        return shell.execCommand(DOCKER+"rm "+nameOrId);
    }


}
